package com.oracle.coherence.patterns.security.accesscontrol;

import javax.security.auth.Subject;
import java.security.Permission;

/**
 * Classes implementing this interface can verify permissions
 * for various types of request.</p>
 *
 * @author Jonathan Knight
 */
public interface PermissionsChecker {

    /**
     * Check whether the specified <code>Subject</code> has authorised for
     * the requested <code>Permission</code>.
     * <p/>
     * If the check fails then a <code>java.lang.SecurityException</code>
     * should be thrown.
     * <p/>
     *
     * @param permission The requested permission
     * @param subject    The subject requesting permission
     * @throws SecurityException if access is not allowed
     */
    public void checkPermission(Permission permission, Subject subject);

}
